package com.kovalko.pages;

import org.openqa.selenium.WebDriver;

/**
 * Created by 4uvak on 04.07.2014.
 */
public class BasePage {
    protected final String url;
    protected final WebDriver driver;
    public BasePage (WebDriver driver, String url) {
        this.driver = driver;
        this.url = url;
    }
    public void open(){
        driver.get(url);
    }
    public boolean isOpened() {
        String currentUrl = driver.getCurrentUrl();
        if (currentUrl.charAt(currentUrl.length()-1) == '/') {
            currentUrl = currentUrl.substring(0, currentUrl.length()-1);
        }
        System.out.println("currentUrl = " + currentUrl + ", url = " + url);
        return currentUrl.equals(url);
    }

}
